<template>
	<view>
		<!-- 		<scroll-view scroll-x class="bg-white nav text-center">
			<view class="cu-item" :class="index==tabIndex?'text-red cur':''" v-for="(item,index) in tabList"
				:key="index" @tap="tabSelect" :data-id="index">
				{{item.text}}
			</view>
		</scroll-view> -->
		<view v-if="dataObj.length === 0">
			<view class="padding-lr padding-bottom" style="margin-top: 10%;">
				<view class="padding-xs flex align-center">
					<view class="flex-sub text-center">
						<view class="solid-bottom text-xsl padding">
							<text class="cuIcon-warnfill text-gray"></text>
						</view>
						<view class="padding">暂无活动，敬请期待</view>
					</view>
				</view>
			</view>
		</view>
		<scroll-view v-else scroll-y class="page show">
			<view class="cu-card case">
				<view class="cu-item shadow" v-for="(item,index) in dataObj" :key="index" @click="gotoDetail(item.id)">
					<view class="image">
						<image :src="item.cover" mode="aspectFill" style="height: 340rpx;"></image>
						<view v-if="item.status===-1" class="cu-tag bg-red">已结束</view>
						<view v-else-if="item.status===0" class="cu-tag bg-orange">未开始</view>
						<view v-else-if="item.status===1" class="cu-tag bg-green">进行中</view>
						<view class="cu-bar bg-shadeBottom">
							<text class="text-cut">{{item.title}}</text>
						</view>
					</view>
					<view class="cu-list menu">
						<view class="cu-item">
							<view class="content">
								<text class="cuIcon-activityfill text-red"></text>
								<text class="">活动地点：{{item.address}}</text>
							</view>
							<view class="action">
								<text class="cuIcon-more"></text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		activity_list
	} from '@/common/api/api.js'

	export default {
		data() {
			return {
				tabIndex: 0,
				tabList: [{
						code: 0,
						text: "同班同学"
					},
					{
						code: 1,
						text: "同城校友"
					}
				],
				dataObj: [],
				params: {},

			};
		},
		onLoad() {
			this.getData()
		},
		methods: {
			getData() {
				this.loadStatus = 'loading'
				activity_list().then(res => {
					let records = this.$s.res(res)
					if (records && records.length > 0) {
						this.dataObj = records
					}
				}).catch(err => {
					this.loadStatus = 'loadmore'
				});
			},
			gotoDetail(e) {
				uni.navigateTo({
					url: './detail?id=' + e
				})
			}
		}
	}
</script>

<style>
	.page {
		height: 100Vh;
		width: 100vw;
	}

	.page.show {
		overflow: hidden;
	}

	.switch-sex::after {
		content: "\e716";
	}

	.switch-sex::before {
		content: "\e7a9";
	}

	.switch-music::after {
		content: "\e66a";
	}

	.switch-music::before {
		content: "\e6db";
	}
</style>